<?php
namespace App\Repos;
use App\Models\Role;

use DB,Log;


class RoleRepo
{
	public static function  pages($where=[],$num=10)
	{	   
	  	$query = Role::query();
	  	if(array_get($where,'keyword')) {
	  		$query->where('name','like','%'.$where['keyword'].'%');
	  		$query->orWhere('name','like','%'.$where['keyword'].'%');
	  	}
	  	$list = $query->paginate($num); 
	  	return $list;     
	}

	public static function getList($where=[])
	{
		return Role::get();
	}

	

	public static function create($data)
	{
		
		
		
	}

	public static function find($where=[])
	{
		return Role::where($where)->first();
	}

	
	

	

	

	public static function update($where,$data)
	{
		$rs['status'] = false;
		$flag = Role::where($where)->update($data);
		if($flag) {
			$rs['status'] = true;
			return $rs;
		}
		return $rs;
	}

	


	

	

	public static function destroy($id)
	{
		return Role::destroy($id);
	}

	

	
	

	

	
	
	

	
	
	
}